package jasonllinux.app.control;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;

public class Activity01 extends Activity {

	
	private ProgressBar bar1 ;
	private ProgressBar bar2;
	private Button button;
	
	private int i;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        bar1 = (ProgressBar)findViewById(R.id.p1);
//        i = bar1.getMax();
        
        bar2 = (ProgressBar)findViewById(R.id.p2);
        button = (Button)findViewById(R.id.button);
        button.setOnClickListener(new ButtonListener());
        
    }
    
    class ButtonListener implements OnClickListener {

		@Override
		public void onClick(View v) {
			if(i==0) {
				bar1.setVisibility(View.VISIBLE);
				bar2.setVisibility(View.VISIBLE);
				i += 10;
			}else if(i< bar1.getMax()) {
				bar1.setProgress(i);
				bar1.setSecondaryProgress(i+10);
				bar2.setProgress(i);
				i += 10;
			}else {
				bar1.setVisibility(View.GONE);
				bar2.setVisibility(View.GONE);
				i = 0;
			}
			
			
		}
    	
    }
}